package cn.npe.dynamic.thread.pool.sdk.event;

import cn.npe.dynamic.thread.pool.sdk.domain.model.entity.ThreadPoolConfigEntity;
import cn.npe.dynamic.thread.pool.sdk.domain.model.entity.ThreadPoolProperties;
import cn.npe.dynamic.thread.pool.sdk.registry.DtpContext;
import org.apache.commons.lang.StringUtils;
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
import org.springframework.boot.context.event.SpringApplicationEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
/**
 * @ClassName DtpEventListener
 * @Author zhjx
 * @Description 线程池刷新
 * @Date 2024/5/23 16:52
 **/
@Component
public class DtpEventListener {//}  implements ApplicationListener<OrderEvent> {

    /**
     * @param event
     * @return
     * @date
     * @description
     */

    @Async
    @EventListener(DtpEvent.class)
    public void onApplicationEvent(DtpEvent event) {
        ThreadPoolConfigEntity threadPoolConfigEntity = event.getThreadPoolConfigEntity();
        DtpContext.refresh(threadPoolConfigEntity);
    }



}